﻿@model zichan.Models.TemporaryEditModel
@{
    ViewBag.Title = "修改用途";
}
@section Pagetitle{
    @AdminCommon.PageTitle("机柜管理列表", "修改用途")
}
@section header{
    <link rel="stylesheet" type="text/css" href="/assets/global/plugins/select2/select2.css" />
    <link href="/assets/global/css/plugins.css" rel="stylesheet" type="text/css" />
}
@using (Html.BeginForm("TemporaryEdit", "Cabinet", FormMethod.Post, new { @class = "form-horizontal" }))
{
    <div class="form-body">
        @Html.AntiForgeryToken()

        @*<input type="hidden" name="tId" value=@ViewBag.tId/>*@
       @Html.HiddenFor(o=>o.tId,new { @Value=ViewBag.tId})
        <div class="form-group ">
            <label class="col-md-3 control-label xh">资产用途:</label>
            <div class="col-md-9">
                @Html.DropDownList("purposeId", (SelectList)ViewBag.serverPurposeIds, "请选择用途", new { @class = "form-control select2 input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.purposeId)
                </span>
            </div>
        </div>
        <div class="form-group " id="subPurpose">

        </div>
        
        <div class="form-actions">
            <div class="row">
                <div class="col-md-offset-3 col-md-9">
                    <button type="submit" class="btn green">提交</button>
                    <a href="/Cabinet/Index" class="btn default">返回</a>
                </div>
            </div>
        </div>
    </div>
}
@section footer{
    @Scripts.Render("~/bundles/jqueryval")
    <script src="/assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/assets/global/plugins/select2/select2.min.js"></script>
    <script src="~/assets/global/plugins/select2/select2_locale_zh-CN.js"></script>
    <script src="~/Scripts/AssetJs.js"></script>
    <script>
        $(function () {
            var re = /^[0-9]+.?[0-9]*$/;
            if (re.test($("#purposeId").val())) {
                var id = $("#purposeId").val();
                $("#subPurpose").load("/Common/part_serverSubPurpose?purposeId=" + id);
            }
            $("#purposeId").on("change", function () {
                var id = $("#purposeId").val();
                $("#subPurpose").load("/Common/part_serverSubPurpose?purposeId=" + id);
            });
           
        })
    </script>
}


